<template>
  <div class="a">

文章标题<input type="text" v-model="title">
<br>
<!-- 是否公开<input type="checkbox" v-model="status"> -->

<van-switch v-model="status" />


<br>
<br>
文章内容<textarea name="" id="" cols="30" rows="4"  v-model="content"></textarea>
<br>
<br>

<button @click="fabu">发布</button>
<button @click="chongzhi">重置</button>
    
  </div>
</template>
<script setup>
import http from '@/router/http';
import { ref } from 'vue';




let title=ref('')
let content=ref('')
let status=ref(false)
 function fabu(){

  http({
  url: '/posts',
  method: 'post',
  data:{title:title.value,content:content.value,status:status.value}

}).then((r) => {
  console.log(r.data);
 
  
})
}

function chongzhi(){

  title.value=''
  content.value=''
  status.value=false

} 
</script>
<style lang="scss" scoped>
  .a{margin-left: 50%;}
</style>